//package com.example.e_comm.vehicle.service.impl;
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.example.vehicle.dto.PageQueryDTO;
//import com.example.vehicle.dto.VehicleReportDTO;
//import com.example.vehicle.entity.Vehicle;
//import com.example.vehicle.mapper.VehicleMapper;
//import com.example.vehicle.service.VehicleService;
//import org.springframework.beans.BeanUtils;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.time.LocalDateTime;
//import java.util.Collection;
//import java.util.List;
//
//@Service
//public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements VehicleService {
//
//    @Override
//    @Transactional
//    public void reportVehicleStatus(VehicleReportDTO reportDTO) {
//        Vehicle vehicle = new Vehicle();
//        BeanUtils.copyProperties(reportDTO, vehicle);
//        vehicle.setLastReportTime(LocalDateTime.now());
//        vehicle.setUpdateTime(LocalDateTime.now());
//
//        // 使用 saveOrUpdate 方法，如果 VIN 存在则更新，不存在则插入
//        this.saveOrUpdate(vehicle);
//    }
//
//    @Override
//    public Vehicle getVehicleByVin(String vin) {
//        return this.getOne(new LambdaQueryWrapper<Vehicle>()
//                .eq(Vehicle::getVin, vin)
//                .eq(Vehicle::getDeleted, 0));
//    }
//
//    @Override
//    public IPage<Vehicle> getVehiclePage(PageQueryDTO queryDTO) {  // 移除泛型参数
//        Page<Vehicle> page = new Page<>(queryDTO.getPageNum(), queryDTO.getPageSize());
//        return baseMapper.selectVehiclePage(page, queryDTO.getVin(), queryDTO.getStatus());
//    }
//
//    @Override
//    public List<Vehicle> getOnlineVehicles() {  // 移除泛型参数
//        return baseMapper.selectOnlineVehicles();
//    }
//
//    @Override
//    @Transactional
//    public void deleteVehicleByVin(String vin) {
//        this.remove(new LambdaQueryWrapper<Vehicle>().eq(Vehicle::getVin, vin));
//    }
//
//    @Override
//    public boolean saveBatch(Collection<Vehicle> entityList) {
//        return super.saveBatch(entityList);
//    }
//
//    @Override
//    public boolean saveOrUpdateBatch(Collection<Vehicle> entityList) {
//        return super.saveOrUpdateBatch(entityList);
//    }
//
//    // 以下方法可以删除，因为父类已经提供了这些方法的默认实现
//    // @Override
//    // public boolean saveBatch(Collection<Vehicle> entityList) {
//    //     return super.saveBatch(entityList);
//    // }
//    //
//    // @Override
//    // public boolean saveOrUpdateBatch(Collection<Vehicle> entityList) {
//    //     return super.saveOrUpdateBatch(entityList);
//    // }
//    //
//    // @Override
//    // public boolean removeBatchByIds(Collection<?> list) {
//    //     return super.removeBatchByIds(list);
//    // }
//}